<div class="main-content">
	<header>
		<a href="<?php echo bu('admin/banners/new'); ?>" class="fr button button-gray">Add Banners</a>
		<h2>Banners</h2>
	</header>

	<section>
    <?php echo $this->renderPartial('/partials/_notifications'); ?>
		<table class="datatable paginate sortable full">
			<thead>
			<tr>
				<th>Name</th>
				<th style="width:250px">Image</th>
				<th>Created At</th>
				<th>Modified At</th>
				<th style="width:70px"></th>
			</tr>
			</thead>
			<tbody>
			<?php foreach ($banners as $banner){ ?>
			<tr>
				<td align="center"><?php echo $banner->name; ?></td>
				<td align="center">
          <?php 
            $file_type = explode('.', $banner->image);
            $count = count($file_type);
            if($file_type[$count-1] == 'swf'){ 			
            list($width, $height, $type, $attr) = getimagesize(Yii::getPathOfAlias('webroot')."/assets/banners/".$banner->image);
          ?>
            <EMBED src="<?php echo bu("assets/banners/".$banner->image); ?>" quality=high NAME="Yourfilename" width='<?php echo $width; ?>' height='<?php echo $height; ?>' ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
          <?php }else{ ?>
            <img style="width:240px;" src ="<?php echo bu("assets/banners/".$banner->image); ?>" />
          <?php } ?>
        </td>
				<td align="center" style="word-wrap:break-word"><?php echo Helpers::customDate($banner->created_at); ?></td>
				<td align="center" style="word-wrap:break-word"><?php echo Helpers::customDate($banner->modified_at); ?></td>
				<td>
				<ul class="action-buttons">
					<li><a href="<?php echo bu('admin/banners/edit'); ?>?id=<?php echo $banner->id; ?>" class="button button-gray no-text"><span class="pencil"></span>Edit</a></li>
					<li><a href="<?php echo bu('admin/banners/delete'); ?>?id=<?php echo $banner->id; ?>" method="POST" class="button button-gray no-text"><span class="bin"></span>Delete</a></li>
				</ul>
				</td>
			</tr>
			<?php } ?>
			</tbody>
		</table>
	</section>
</div>